home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_6 / KDEBUG.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  76 lines

  1. /* $Id: kdebug.h,v 1.10 1997/12/14 23:24:40 ecd Exp $
  2.  * kdebug.h:  Defines and definitions for debugging the Linux kernel
  3.  *            under various kernel debuggers.
  4.  *
  5.  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  6.  */
  7. #ifndef _SPARC_KDEBUG_H
  8. #define _SPARC_KDEBUG_H
  9.  
  10. #include <asm/openprom.h>
  11.  
  12. /* The debugger lives in 1MB of virtual address space right underneath
  13.  * the boot prom.
  14.  */
  15.  
  16. #define DEBUG_FIRSTVADDR       0xffc00000
  17. #define DEBUG_LASTVADDR        LINUX_OPPROM_BEGVM
  18.  
  19. /* Breakpoints are enter through trap table entry 126.  So in sparc assembly
  20.  * if you want to drop into the debugger you do:
  21.  *
  22.  * t DEBUG_BP_TRAP
  23.  */
  24.  
  25. #define DEBUG_BP_TRAP     126
  26.  
  27. #ifndef __ASSEMBLY__
  28. /* The debug vector is passed in %o1 at boot time.  It is a pointer to
  29.  * a structure in the debuggers address space.  Here is its format.
  30.  */
  31.  
  32. typedef unsigned int (*debugger_funct)(void);
  33.  
  34. struct kernel_debug {
  35.     /* First the entry point into the debugger.  You jump here
  36.      * to give control over to the debugger.
  37.      */
  38.     unsigned long kdebug_entry;
  39.     unsigned long kdebug_trapme;   /* Figure out later... */
  40.     /* The following is the number of pages that the debugger has
  41.      * taken from to total pool.
  42.      */
  43.     unsigned long *kdebug_stolen_pages;
  44.     /* Ok, after you remap yourself and/or change the trap table
  45.      * from what you were left with at boot time you have to call
  46.      * this synchronization function so the debugger can check out
  47.      * what you have done.
  48.      */
  49.     debugger_funct teach_debugger;
  50. }; /* I think that is it... */
  51.  
  52. extern struct kernel_debug *linux_dbvec;
  53.  
  54. /* Use this macro in C-code to enter the debugger. */
  55. extern __inline__ void sp_enter_debugger(void)
  56. {
  57.     __asm__ __volatile__("jmpl %0, %%o7\n\t"
  58.                  "nop\n\t" : :
  59.                  "r" (linux_dbvec) : "o7", "memory");
  60. }
  61.  
  62. #define SP_ENTER_DEBUGGER do { \
  63.          if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
  64.            sp_enter_debugger(); \
  65.                } while(0)
  66.  
  67. #endif /* !(__ASSEMBLY__) */
  68.  
  69. /* Some nice offset defines for assembler code. */
  70. #define KDEBUG_ENTRY_OFF    0x0
  71. #define KDEBUG_DUNNO_OFF    0x4
  72. #define KDEBUG_DUNNO2_OFF   0x8
  73. #define KDEBUG_TEACH_OFF    0xc
  74.  
  75. #endif /* !(_SPARC_KDEBUG_H) */
  76.